package com.biyabi.controller;

import com.biyabi.pojo.OrderData;
import com.biyabi.pojo.Result;
import com.biyabi.service.OrderService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/back/order")
public class OrderController {
    @Resource
    private OrderService orderService;
    @RequestMapping("/findAll")
    public OrderData findAll(Integer currentPage, Integer pageSize,String columnName,String columnValue ){
        return orderService.selectAll(currentPage,pageSize,columnName,columnValue);
    }
    @RequestMapping("/updateStatus")
    public Result updateStatus(String id,Integer status){
        System.out.println(id+"  ----  "+status);
        Result result = new Result();
        try{
            orderService.updateStatus(id,status);
            result.setStatus(true);
            result.setMessage("修改商品状态成功");
        }catch(Exception e){
            result.setStatus(false);
            result.setMessage("修改商品状态失败");
        }
        return result;
    }
}
